package fr.web325.servlet.admin.goods;

import fr.web325.dao.BookDao;
import fr.web325.dao.NoticeDao;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/shop/admin/removeGoods")
public class RemoveNotice extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws  IOException {
        // 根据ID删除
        String id = req.getParameter("id");
//        System.out.println("获取的ID"+id);
        try {
            if(new BookDao().removeBookById(id)){
                // 重定向
                resp.sendRedirect("goods");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
